<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/prewimg.css">
		<link rel="stylesheet" type="text/css" href="../erweima/iconfont.css"/>
		<style type="text/css">
			html,
			body {
				width: 100%;
				height: 100%;
				margin-top: 0;
			}
			
			.mui-pull-left {
				margin-top: 10px;
				font-size: 20px;
				color: #FFFFFF;
			}
			
			#link_my_qrcode1 {
				float: right;
				color: #FFFFFF;
			}
			
			.mui-content {
				background-color: #F7F7F7;
				z-index: 99;
				display: none;
			}
			
			.bgcolor-div {
				width: 100%;
				background-color: white;
			}
			
			.topimg-div {
				width: 100%;
			}
			
			.head-div {
				width: 100%;
				display: flex;
			}
			
			.padding-div {
				width: 22%;
				background: linear-gradient(white, #EDEDED);
				margin-top: -12%;
				margin-left: 3%;
				border-radius: 1px;
				display: flex;
				padding: 2px;
			}
			
			.padding-div .headimg {
				width: 100%;
				height: 100%;
			}
			
			.sex-img {
				width: 16px;
				height: 16px;
				position: absolute;
				right: 3%;
				margin-top: 1.8%;
			}
			
			.name-span {
				margin-left: 3%;
				margin-top: 1%;
			}
			
			.topimg {
				width: 100%;
			}
			
			.content-div {
				width: 94%;
				margin-left: 3%;
			}
			
			.hr-div {
				border-bottom: 1px solid #F1F1F1;
			}
			
			.hr-div input {
				margin-bottom: 0;
				font-size: 90%;
			}
			
			#gexingname {
				padding: 0;
				padding-left: 3%;
				border: 0;
				color: #767676;
			}
			
			.zhanghao-div {
				padding: 2% 0;
				border-bottom: 1px solid #F1F1F1;
				width: 100%;
				font-size: 90%;
				height: auto;
			}
			
			.zhanghao-div .input {
				width: 70%;
				color: #363434;
				border: 0;
				margin-bottom: 0;
				margin-left: 8%;
				font-size: 96%;
			}
			
			.threebutton-div {
				width: 99.4%;
				display: flex;
				margin-top: 5%;
				margin-left: 0.3%;
				padding-bottom: 5%;
			}
			
			.button-div {
				width: 33.3333%;
				display: flex;
			}
			
			.button-div button {
				width: 80%;
				padding: 1%;
				font-size: 90%;
				border-color: #B7B7B7;
			}
			
			.button-div1 {
				width: 33.3333%;
				display: flex;
				justify-content: center;
			}
			
			.button-div1 button {
				width: 80%;
				padding: 1%;
				font-size: 90%;
				border-color: #B7B7B7;
			}
			
			.button-div2 {
				width: 33.3333%;
			}
			
			.button-div2 button {
				width: 80%;
				padding: 1%;
				font-size: 90%;
				border-color: #B7B7B7;
				float: right;
			}
			
			.mui-table-view {
				background-color: #F7F7F7;
			}
			
			#imgcontent {
				width: 100%;
				padding-left: 3.5%;
				display: flex;
				flex-wrap: wrap;
				margin-bottom: 4px;
			}
			
			.mui-card {
				background-color: white;
				width: 100%;
				margin-left: 0;
				height: auto;
				box-shadow: none!important;
				margin-top: 3%;
			}
			
			.mui-card-header {
				border: 0!important;
			}
			
			.mui-media-body span {
				font-size: 95%;
				display: block;
			}
			
			.mui-media-body text {
				font-size: 80%;
				color: #A7A5A5;
			}
			
			.del-div {
				width: 6%;
				float: right;
				margin-top: -14px;
				margin-right: 2%;
			}
			
			.del-div img {
				width: 100%;
			}
			
			.del-div span {
				display: none;
			}
			
			.area-div {
				display: flex;
				margin-left: 3%;
				color: #A7A5A5;
				font-size: 80%;
				align-items: center;
			}
			
			.area-div .area-img {
				width: 4%;
				height: 4%;
			}
			
			.write-div {
				width: 91%;
				font-size: 90%;
				z-index: 99;
				margin-left: 3.5%;
				padding-bottom: 1%;
			}
			
			.mui-cardfooter {
				display: flex;
				justify-content: center;
				align-items: center;
				flex-wrap: wrap;
				font-size: 130%;
				padding: 5px 0;
				margin: 0;
				color: #000000;
				box-shadow: none;
				border-top: 1px solid #F5F5F5;
			}
			
			.foot-cont {
				width: 33.3333%;
			}
			
			.foot-cont text {
				display: none;
			}
			
			.commentcont text {
				display: none;
			}
			
			.imgarea {
				overflow: hidden;
				background-color: aqua;
				margin: 0.5%;
				border-radius: 2px;
			}
			
			.imgarea img {
				margin-bottom: 0;
			}
			
			.mui-card-footer-bar {
				display: flex;
				justify-content: center;
				align-items: center;
			}
			
			.mui-card-footer-bar span {
				margin-left: 3%;
			}
			
			.footer-num {
				font-size: 70%;
			}
			
			li {
				list-style: none;
				background-color: aqua
			}
			
			.nodong-div {
				width: 100%;
				display: flex;
				flex-wrap: wrap;
				justify-content: center;
				padding: 20% 0;
				background-color: white;
				margin-top: 3%;
			}
			
			.img-div {
				width: 100%;
			}
			
			.img-png {
				width: 26%;
				margin-left: 37%;
			}
			
			.btn-div {
				width: auto;
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: #1484FE;
				font-size: 80%;
				margin-bottom: 0;
				width: 40%;
				padding: 2% 0;
				border-radius: 4px;
				margin-top: 3%;
			}
			
			.btn-div span {
				margin-top: 1%;
				color: #FFFFFF;
				margin-left: 2%;
			}
			
			.add-png {
				width: 7%;
				height: 7%;
				margin-bottom: 0;
			}
			
			.mui-table-view:after,
			.mui-table-view:before {
				background-color: white!important;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-transparent" id="header" style="z-index: 5;" data-scrollby=".mui-scroll-wrapper">
			<a class="mui-pull-left iconfont icon-erweima-copy-copy" id="link_my_qrcode"></a>
			<a class="mui-icon mui-icon-arrowup" id="link_my_qrcode1"></a>
		</header>
		<div class="mui-content" id="mui-content">
			<div class="mui-scroll-wrapper">
				<div class="mui-scroll">
					<div class="bgcolor-div">
						<div class="topimg-div">
							<img src="" class="topimg" id="topimg" />
						</div>

						<div class="head-div">
							<div class="padding-div" id="headimgg"><img src="" class="headimg" id="headimg" /></div>
							<span class="name-span" id='nickname'>将就看</span>
							<img src="" class="sex-img" id="sexpng" />
						</div>
						<div class="hr-div"><input type="text" id="gexingname" placeholder="个性签名.." disabled="false" /></div>

						<div id="" class="content-div">
							<div class="zhanghao-div">
								<span>账号</span>
								<input class="input" type="text" id="zhanghao" placeholder="回显内容" disabled="false" />
							</div>
							<div class="zhanghao-div">院系<input class="input" type="text" id="yuanxi" placeholder="回显内容" disabled="false" /></div>
							<div class="zhanghao-div">专业<input class="input" type="text" id="zhuanye" placeholder="回显内容" disabled="false" /></div>
							<div class="threebutton-div">
								<a class="button-div" id="wdtai"><button class="button" type="button">写动态</button></a>
								<a class="button-div1"><button class="button" type="button" id="inform">通知</button></a>
								<a class="button-div2"><button class="button" type="button" id="install">设置</button></a>
							</div>
						</div>
					</div>
					<div class="nodong-div" id="nodong">
						<div class="img-div"><img src="../images/pll.png" class="img-png" /></div>
						<div class="btn-div" id="fadong">
							<img src="../images/fadong.png" class="add-png" />
							<span>发一条动态吧</span>
						</div>
					</div>
					<div id="contimg" style="width: 100%;">
						<ul class="mui-table-view mui-table-view-chevron" id="imgggg">
							<!--动态列表渲染处-->
						</ul>
					</div>
				</div>
			</div>
		</div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/mui.zoom.js"></script>
		<script src="../js/mui.previewimage.js"></script>
		<script src="../js/arttmpl.js"></script>
		<script src="../js/immersed.js"></script>
		<script src="../js/app.min.js"></script>
		<script type="text/javascript" src="../js/app.js"></script>
		<script type="text/javascript">
			mui.previewImage(function(img) {
				plus.webview.currentWebview().setStyle({
					top: '0',
					bottom: '0'
				})
			}, function(img) {
				plus.webview.currentWebview().setStyle({
					top: '0',
					bottom: '50px'
				})
			});
			mui.init({
				preloadPages: [{
					url: "install.html",
					id: "install.html"
				}]
			});
			mui.ready(function() {
				mui.plusReady(function() {
					starbar();
					document.getElementById('mui-content').style.cssText = "margin-top: 0;"
					plus.nativeUI.showWaiting();
					mui.ajax(app.serverUrl + '/mineController/queryMyNews', {
						data: {
							lyuser_Card: plus.storage.getItem("card")
						},
						crossDomain: true, //强制使用5+跨域
						dataType: 'json', //服务器返回json格式数据
						type: 'get', //HTTP请求类型
						timeout: 10000, //超时时间设置为10秒；
						//processData: false,
						headers: {
							'Content-Type': 'application/x-www-form-urlencoded'
						},
						success: function(data) {
							console.log(JSON.stringify(data.userNews));
							allcont = data.userNews;
							document.getElementById('nickname').textContent = allcont.lyuser_NickName;
							document.getElementById('zhanghao').value = allcont.lyuser_Card;
							document.getElementById('yuanxi').value = allcont.lyuser_YuanXi;
							document.getElementById('zhuanye').value = allcont.lyuser_Major;
							document.getElementById('gexingname').value = allcont.lyuser_AWord;
							document.getElementById('topimg').src = allcont.lyuser_BackPath;
							document.getElementById('headimg').src = allcont.lyuser_FacePath;
							var sex = document.getElementById('sexpng');
							if(allcont.lyuser_Sex == 1) {
								sex.src = '../images/man.png'
							} else {
								sex.src = '../images/girl.png'
							}
							mui.ajax('https://www.lunyuwang.com/mineController/queryAllDongTai', {
								data: {
									lyuser_Card: plus.storage.getItem("card"),
								},
								crossDomain: true, //强制使用5+跨域
								dataType: 'json', //服务器返回json格式数据
								type: 'get', //HTTP请求类型
								timeout: 10000, //超时时间设置为10秒；
								//processData: false,
								headers: {
									'Content-Type': 'application/x-www-form-urlencoded'
								},
								success: function(data) {
									var record = data.userDongTai;
									console.log(record);
									if(record == '0') {
										plus.nativeUI.closeWaiting();
										document.getElementById('mui-content').style.display = 'block';
										return;
									}
									for(var i = 0; i < record.length; i++) {
										if(record[i].lydongtai_Img) {
											var a = '';
											a = record[i].lydongtai_Img.split(',');
											record[i].lydongtai_Img = a;
										} else {
											record[i].lydongtai_Img = '';
										}
										if(record[i].lydongtai_Whb) {
											var b = '';
											b = record[i].lydongtai_Whb.split(',');
											record[i].lydongtai_Whb = b;
										} else {
											record[i].lydongtai_Whb = '';
										}
									}

									//利用图灵接口演示聊天布局 
									//追加模板消息 
									var str = template('card-img-tigan', {
										"record": record
									});
									document.getElementById('imgggg').innerHTML = str;
									var dong = document.getElementById('nodong');
									if(record != '') {
										dong.style.display = 'none'
									}
									var viewwidth = document.body.clientWidth;
									var imgas = document.getElementsByClassName("imgcontent");
									var topimg = document.getElementById('topimg');
									var headimgg = document.getElementById('headimgg');
									topimg.style.height = "-webkit-calc(" + viewwidth * 0.65 + "px)";
									headimgg.style.height = "-webkit-calc(" + viewwidth * 0.22 + "px)";
									for(var i = 0; i < imgas.length; i++) {
										if(record[i].lydongtai_Img.length >= 3) {
											for(var j = 0; j < record[i].lydongtai_Img.length; j++) {
												var divimg = imgas[i].getElementsByTagName("div")[j];
												var imgarray = imgas[i].getElementsByTagName("img")[j];
												realbi = record[i].lydongtai_Whb[j];
												divimg.style.cssText = "width: 31%;height: -webkit-calc(" + viewwidth * 0.31 + "px)";
												if(realbi >= 1) {
													var num = viewwidth * 0.31 * 0.5 * (realbi - 1);
													imgarray.style.cssText = "width: -webkit-calc(" + viewwidth * 0.31 * realbi + "px);height: 100%;margin-left: -webkit-calc(" + (-num) + "px);";
												} else {
													var num = (viewwidth * 0.31 / realbi - viewwidth * 0.28) / 2;
													divimg.style.cssText = "width: 31%;height: -webkit-calc(" + viewwidth * 0.31 + "px);";
													imgarray.style.cssText = "width: 100%;height: -webkit-calc(" + viewwidth * 0.31 / realbi + "px);margin-top: -webkit-calc(" + (-num) + "px);"
												}
											}
										} else if(record[i].lydongtai_Img.length == 1) {
											var divimg = imgas[i].getElementsByTagName("div")[0];
											var imgarray = imgas[i].getElementsByTagName("img")[0];
											realbi = record[i].lydongtai_Whb[0];
											console.log(realbi);
											if(realbi >= 1) {
												divimg.style.cssText = "width: 60%;max-height: -webkit-calc(" + viewwidth * 0.9 + "px);height: -webkit-calc(" + viewwidth * 0.6 / realbi + "px);";
												imgarray.style.cssText = "width: 100%;height: -webkit-calc(" + viewwidth * 0.6 / realbi + "px);";
											} else {
												divimg.style.cssText = "width: 66%;max-height: -webkit-calc(" + viewwidth + "px);height: -webkit-calc(" + viewwidth * 0.66 / realbi + "px);";
												imgarray.style.cssText = "width: 100%;height: -webkit-calc(" + viewwidth * 0.66 / realbi + "px);"
											}
										} else if(record[i].lydongtai_Img.length == 2) {
											for(var j = 0; j < record[i].lydongtai_Img.length; j++) {
												var divimg = imgas[i].getElementsByTagName("div")[j];
												var imgarray = imgas[i].getElementsByTagName("img")[j];
												realbi = record[i].lydongtai_Whb[j];
												divimg.style.cssText = "width: 38%;height: -webkit-calc(" + viewwidth * 0.36 + "px)";
												if(realbi >= 1) {
													var num = (viewwidth * 0.36 - viewwidth * 0.38 * realbi) / 2;
													imgarray.style.cssText = "width: -webkit-calc(" + viewwidth * 0.38 * realbi + "px);height: 100%;margin-left: -webkit-calc(" + num + "px);";
												} else {
													var num = (viewwidth * 0.38 / realbi - viewwidth * 0.36) / 2;
													imgarray.style.cssText = "width: 100%;height: -webkit-calc(" + viewwidth * 0.38 / realbi + "px);margin-top: -webkit-calc(" + (-num) + "px);"
												}
											}
										} else {
											console.log(11111111);
										}

									}
									plus.nativeUI.closeWaiting();
									document.getElementById('mui-content').style.display = 'block';
								}
							})

						}
					})
				})
			})

			window.onload = function() {
				mui.plusReady(function() {
					var dong = document.getElementById('nodong');
					mui('.mui-bar-transparent').transparent({
						top: 0,
						offset: 150,
						duration: 16,
						scrollby: document.querySelector('.mui-scroll-wrapper')
					})

					var scroll = mui('.mui-scroll-wrapper').scroll();
					document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
						var mytext = document.getElementById('link_my_qrcode');
						var myicon = document.getElementById('link_my_qrcode1');
						if(scroll.y < -150) {
							mytext.style.color = '#3B559F';
							myicon.style.color = '#3B559F';
							plus.navigator.setStatusBarStyle('dark');
						} else {
							mytext.style.color = '#FFFFFF';
							myicon.style.color = '#FFFFFF';
							plus.navigator.setStatusBarStyle('light');
						}
					})
					document.getElementById('inform').addEventListener('tap', function() {
						mui.openWindow({
							url: 'mine/inform.html',
							id: 'mine/inform.html'
						})
					})

					// 查看我的二维码
					var link_my_qrcode = document.getElementById("link_my_qrcode");
					link_my_qrcode.addEventListener("tap", function() {
						mui.openWindow({
							url: "myQRCode.html",
							id: "myQRCode.html",
							styles: {}
						})
					});

					document.getElementById('link_my_qrcode1').addEventListener('tap', function() {
						mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 100);
					})

					document.getElementById('wdtai').addEventListener('tap', function() {
						mui.openWindow({
							url: 'wdtai.html',
							id: 'wdtai.html',
						})
					})

					document.getElementById('fadong').addEventListener('tap', function() {
						mui.openWindow({
							url: 'wdtai.html',
							id: 'wdtai.html',
						})
					})

					document.getElementById('install').addEventListener('tap', function() {
						mui.openWindow({
							url: 'install.html',
							id: 'install.html',
						})
					})

					mui(document).on('tap', '.deletedt', function(e) {
						var id = this.getElementsByTagName('text')[0].textContent;
						var imgs = this.getElementsByTagName('text')[1].textContent;
						var licont = document.getElementsByClassName('li-content');
						mui.confirm('确认删除？', function(e) {
							if(e.index == 0) {
								console.log(plus.storage.getItem("card") + "-----" + id.replace(/<[^>]+>|&[^>]+;/g, "").trim() + "-----" + imgs);
								mui.ajax('https://www.lunyuwang.com/mineController/deleteDongTai', {
									data: {
										lyuser_Card: plus.storage.getItem("card"),
										lydongtai_Id: id,
										lydongtai_Img: imgs
									},
									crossDomain: true, //强制使用5+跨域
									dataType: 'json', //服务器返回json格式数据
									type: 'get', //HTTP请求类型
									timeout: 10000, //超时时间设置为10秒；
									//processData: false,
									headers: {
										'Content-Type': 'application/x-www-form-urlencoded'
									},
									success: function(data) {
										if(data.state == 1) {
											for(var i = 0; i < licont.length; i++) {
												if(licont[i].getElementsByTagName('p')[0].textContent.replace(/<[^>]+>|&[^>]+;/g, "").trim() == id) {
													licont[i].parentNode.removeChild(licont[i]);
													mui.toast('删除成功!');
												}
											}
											var num = document.getElementsByClassName('li-content');
											if(num.length == 0) {
												dong.style.display = 'flex'
											}
										}
									}
								})
							}
						})
					})

					mui(document).on('tap', '.commentcont', function() {
						var id = this.getElementsByTagName('text')[0].textContent;
						var nick = document.getElementById('nickname').textContent;
						mui.openWindow({
							url: 'mine/comment.html',
							id: 'mine/comment.html',
							extras: {
								adongtai_id: id,
								nick_name: nick
							} //自定义扩展参数
						})
					})
				})
			}

			window.addEventListener('changeto', function(event) {
				var nick = document.getElementById('nickname');
				document.getElementById('gexingname').value = event.detail.aword;
				if(nick.textContent == event.detail.nick) {
					return;
				} else {
					nick.textContent = event.detail.nick;
					mui('.nickspan').each(function() {
						this.textContent = event.detail.nick;
					})
				}
			})
			window.addEventListener('reefresh', function(e) { //执行刷新
				location.reload();
			});

			//预览图片时下载文件到相册
			var imgsrc = '';
			mui(document.body).on('tap', 'img[data-preview-src]', function() {
				imgsrc = this.src;
			})

			document.getElementById('downloadbtn').addEventListener('tap', function() {
				var btnArray = ['保存', '取消'];
				mui.confirm('是否保存图片？', '保存图片到相册', btnArray, function(e) {
					if(e.index == 0) {
						var timestamp = (new Date()).valueOf();
						var downLoader = plus.downloader.createDownload(imgsrc, {
							method: 'GET'
						}, function(download, status) {
							var fileName = download.filename;
							//保存至本地相册
							plus.gallery.save(fileName, function() {
								mui.toast("保存成功");

							});
						});
						//开始下载任务
						downLoader.start();
					}
				})
			})

			mui.plusReady(function() {
				//初始化头像，和预览图
				document.getElementById("topimg").addEventListener('tap', function() {
					gallerybgImg();
				})

				//弹出菜单
				mui(".head-div").on("tap", "#headimg", function(e) {
					if(mui.os.plus) {
						var a = [{
							title: "拍照"
						}, {
							title: "从手机相册选择"
						}];
						plus.nativeUI.actionSheet({
							title: "修改头像",
							cancel: "取消",
							buttons: a
						}, function(b) {
							switch(b.index) {
								case 0:
									break;
								case 1:
									getImage();
									break;
								case 2:
									galleryImg();
									break;
								default:
									break
							}
						})
					}

				});
			});

			//拍照
			function getImage() {
				var c = plus.camera.getCamera();
				c.captureImage(function(e) {
					//存储到本地
					plus.io.resolveLocalFileSystemURL(e, function(entry) {
						cutImage(entry.toLocalURL()); //裁剪图片，传入绝对地址
					}, function(e) {
						console.log("读取拍照文件错误：" + e.message);
					});
				}, function(s) {
					console.log("error" + s);
				}, {
					filename: "_doc/head.jpg"
				})
			}

			//相册
			function galleryImg() {
				plus.gallery.pick(function(a) {
					plus.io.resolveLocalFileSystemURL(a, function(entry) {　　　　　　 //entry为图片原目录（相册）流
						cutImage(entry.toLocalURL());
					}, function(e) {
						console.log("读取图片错误：" + e.message);
					});
				}, function(a) {}, {
					filter: "image"
				})
			};

			//相册
			function gallerybgImg() {
				plus.gallery.pick(function(a) {
					plus.io.resolveLocalFileSystemURL(a, function(entry) {　　　　　　 //entry为图片原目录（相册）流
						cutbgImage(entry.toLocalURL());
					}, function(e) {
						console.log("读取图片错误：" + e.message);
					});
				}, function(a) {}, {
					filter: "image"
				})
			};
			//裁剪背景图片
			function cutbgImage(path) {
				mui.openWindow({
					url: 'cutbgimg.html',
					id: 'cutimg.html',
					extras: {
						path: path,
					},
					show: {
						aniShow: 'zoom-fade-in',
						duration: 800
					},
					waiting: {
						autoShow: true
					}
				});
			}

			//裁剪图片
			function cutImage(path) {
				mui.openWindow({
					url: 'cutimg.html',
					id: 'cutimg.html',
					extras: {
						path: path,
					},
					show: {
						aniShow: 'zoom-fade-in',
						duration: 800
					},
					waiting: {
						autoShow: true
					}
				});
			}
			//更新用户头像，主要是裁剪页面裁剪完后触发的
			//添加updateHeadImg自定义事件监听
			var scroll = mui('.mui-scroll-wrapper').scroll();
			window.addEventListener('newsId', function(event) {
				var mytext = document.getElementById('link_my_qrcode');
				var myicon = document.getElementById('link_my_qrcode1');
				if(scroll.y < -150) {
					mytext.style.color = '#3B559F';
					myicon.style.color = '#3B559F';
					plus.navigator.setStatusBarStyle('dark');
				}

			})
			window.addEventListener('updateHeadImg', function(event) {
				mui.plusReady(function() {
					if(event.detail.imgpath) {
						//						mui.alert(event.detail.imgpath);
						document.getElementById("headimg").src = event.detail.imgpath;
						console.log(event.detail.imgpath);
						mui.ajax({
							url: 'https://www.lunyuwang.com/mineController/uploadFaceImg',
							data: {
								imgData: event.detail.imgpath,
								lyuser_Card: plus.storage.getItem("card"),
							},
							async: true, //将false改为true
							crossDomain: true, //强制使用5+跨域
							dataType: 'json', //服务器返回json格式数据
							type: 'post', //HTTP请求类型
							timeout: 10000, //超时时间设置为10秒；
							//processData: false,
							headers: {
								'Content-Type': 'application/x-www-form-urlencoded'
							},
							success: function(data) {
								if(data.userNews == null) {
									mui.alert("上传失败!")
								} else if(data.state == 0) {
									mui.alert("上传失败!")
								} else {
									document.getElementById("headimg").src = data.userNews.lyuser_FacePath;
									mui('.imggg').each(function() {
										this.src = data.userNews.lyuser_FacePath;
									})
								}
							},
							error: function(xhr, type, errorThrown) {
								mui.toast("上传失败！");
							}
						});
					} else {
						//mui.alert(event.detail.img_path);
						//document.getElementById("topimg").src = event.detail.img_path;
						mui.ajax({
							url: 'https://www.lunyuwang.com/mineController/uploadBackImg',
							data: {
								imgData: event.detail.img_path,
								lyuser_Card: plus.storage.getItem("card"),
							},
							async: true, //将false改为true
							crossDomain: true, //强制使用5+跨域
							dataType: 'json', //服务器返回json格式数据
							type: 'post', //HTTP请求类型
							timeout: 10000, //超时时间设置为10秒；
							//processData: false,
							headers: {
								'Content-Type': 'application/x-www-form-urlencoded'
							},
							success: function(data) {
								if(data.userNews == null) {
									mui.alert("上传失败!")
								} else if(data.state == 0) {
									mui.alert("上传失败!")
								} else {
									document.getElementById("topimg").src = data.userNews.lyuser_BackPath;
								}
							},
							error: function(xhr, type, errorThrown) {
								mui.toast("上传失败了！");
							}
						});
					}
				})
			});
			//按两次返回键退出应用
			var first = null;
			var old_back = mui.back;
			//重写返回事件
			mui.back = function() {
				//判断是否打开图片预览，如果是，就先关掉图片，否则直接关闭当前页面
				if(document.querySelector(".mui-preview-in")) {
					mui.previewImage().close();
					return;
				} else {
					mui.plusReady(function() {
						//首页返回键处理
						//处理逻辑：1秒内，连续两次按返回键，则退出应用；
						if(!first) {
							first = new Date().getTime();
							mui.toast('再按一次退出应用');
							setTimeout(function() {
								first = null;
							}, 1000);
						} else {
							if(new Date().getTime() - first < 1000) {
								plus.runtime.quit();
							}
						}
					});
				}
			}
		</script>

		<!--渲染模板-->
		<script type="text/template" id="card-img-tigan">
			<% for(var i in record){ var item=record[i]; %>
			<li class="li-content">
				<p style="display: none;">
					<%=item.lydongtai_Id%>
				</p>
				<div class="mui-card">
					<div class="mui-card-header mui-card-media cardtop">
						<img src="<%=item.lyuser_FacePath%>" id="tigan<%=(i+1)%>" class="imggg" />
						<div class="mui-media-body">
							<span id="name<%=(i+1)%>" class="nickspan"><%=item.lyuser_NickName%></span>
							<text id="time<%=(i+1)%>"><%=item.lydongtai_Time%></text>
							<!--<div class="del-div"><span><%=item.lydongtai_Id%></span><img class="del-img" src="../images/caa.png" /></div>-->
						</div>
					</div>
					<div id="write-div<%=(i+1)%>" class="write-div">
						<%=item.lydongtai_Text%>
					</div>
					<div class="mui-card-content" style="margin: 1% 0">
						<div id="imgcontent" class="imgcontent">
							<% for(var j in item.lydongtai_Img){ var res=item.lydongtai_Img[j]; %>
							<div class="imgarea"><img src="<%=res%>" id="<%=(i+1)%>" data-preview-src="" data-preview-group="<%=(i+1)%>" /></div>
							<% } %>
						</div>
						<% if(item.lydongtai_Address) { %>
						<div class="area-div">
							<img src="../images/dwei.png" class="area-img" />
							<span id=""><%=item.lydongtai_Address%></span>
						</div>
						<% } %>
					</div>
					<div class="mui-cardfooter">
						<div class="foot-cont">
							<div class="mui-card-footer-bar"><img src="../images/zann.png" width="15%" /><span class="footer-num"><%=item.lydongtai_Good%></span></div>
						</div>
						<div class="foot-cont comment">
							<div class="mui-card-footer-bar commentcont"><text><%=item.lydongtai_Id%></text><img src="../images/talk.png" width="15%" /><span class="footer-num">评论</span></div>
						</div>
						<div class="delete-div foot-cont">
							<div class="mui-card-footer-bar deletedt">
								<img src="../images/dele.png" width="15%" />
								<text><%=item.lydongtai_Id%></text>
								<text><%=item.lydongtai_Img.toString()%></text>
								<span class="footer-num">删除</span>
							</div>
						</div>
					</div>
				</div>
			</li>
			<% } %>
		</script>

	</body>

</html>